<?
/*----------------------------------------------------------------------
          (C) Bobtail-Bear 2006 	小飞熊新一代下载系统
          	代码编写：小飞熊	版权所有：小飞熊[L.F.Bear]
				官方网站/技术支持：http://www.lfbear.cn
------------------------------------------------------------------------
          (C) Bobtail-Bear 2006 	L.F.Bear's New Download Sysytem
          	Powered by L.F.Bear  Copyright L.F.Bear's Home(R)
               Official Web/Support：http://www.lfbear.cn
-----------------------------------------------------------------------*/

//本页脚本功能：付分下载扣分转向页1

ob_start();
session_start();
require("include/config.base.php");
require("include/config.inc.php");
require("function.php");
require_once("language/{$syslang}/function.php");

$id=$_GET[id];
$link=$_GET[link];
//判断来源是否存在问题
if(empty($id) || empty($link))
{
	$e_title=$f_lang[61];
	$e_msg=$f_lang[64];
	$e_link=$f_lang[62];
	require("error.php");
}
if(!file_exists($path_soft."/".$id.".php"))
{
	$e_title=$f_lang[61];
	$e_msg=$f_lang[65];
	$e_link=$f_lang[66];
	require("error.php");
}
if($safe=="y")
{
$cookie="r0a5n2d1_".$id;
$xx=$_COOKIE[$cookie];
$xxx=mimi();
$xxx=$xxx."_".$id;
if($xx!=$xxx)
{
	$e_title=$f_lang[61];
	$e_msg=$f_lang[63];
	$e_link=$f_lang[62];
	require("error.php");
}
}
$softinfo=readf($path_soft."/".$id.".php");
$softinfo=explode("|",$softinfo);
//偷个懒儿吧～
$info_num=array("qx"=>"24","p1"=>"26","v1"=>"27","o2"=>"28","p2"=>"30","v2"=>"31","o3"=>"32","p3"=>"34","v3"=>"35","o4"=>"36","p4"=>"38","v4"=>"39","o5"=>"40","p5"=>"42","v5"=>"43");
$username=$_SESSION[f_name];
if(ispopedom($softinfo[$info_num[qx]]))
{
switch($link)
{
case 1:
$value=$softinfo[$info_num[v1]];
$isopen=1;
$downpath=$softinfo[$info_num[p1]];
break;
case 2:
$value=$softinfo[$info_num[v2]];
$isopen=$softinfo[$info_num[o2]];
$downpath=$softinfo[$info_num[p2]];
break;
case 3:
$value=$softinfo[$info_num[v3]];
$isopen=$softinfo[$info_num[o3]];
$downpath=$softinfo[$info_num[p3]];
break;
case 4:
$value=$softinfo[$info_num[v4]];
$isopen=$softinfo[$info_num[o4]];
$downpath=$softinfo[$info_num[p4]];
break;
case 5:
$value=$softinfo[$info_num[v5]];
$isopen=$softinfo[$info_num[o5]];
$downpath=$softinfo[$info_num[p5]];
break;
}

if(!$isopen || $value<=0) 
{
	$e_title=$f_lang[61];
	$e_msg=$f_lang[64];
	$e_link=$f_lang[62];
	require("error.php");
}

if($_SESSION[f_login]!="yes" || $_COOKIE[l_state]!="ok")
{
	$e_title=$f_lang[61];
	$e_msg=$f_lang[67];
	$e_link=$f_lang[66];
	require("error.php");
}

if($_SESSION[f_point]<$value)
{
	$e_title=$f_lang[61];
	$e_msg=$f_lang[68];
	$e_link=$f_lang[66];
	require("error.php");
}

	$sessionname="pay".$id."_".$link;
	$username=$_SESSION[f_name];
	if($_SESSION[$sessionname]!=1 && download($username,$value,$path_user))
    $_SESSION[$sessionname]=1;
	$sid=md5(md5(date(Ymd)));
}

require("include/template.php");
$imagepath="template/".$t_path."/images";
require("include/config.base.php");
require_once("language/".$syslang."/front.php");

	require("template.php");
	$page = new SmartTemplate( "down.html" );
	$page->assign('imagepath',$imagepath);
	$page->assign('id',$id);
	$page->assign('link',$link);
	$page->assign('sid',$sid);
	$page->assign('value',$value);
	$page->assign('t_lang',$t_lang);
	$page->assign('encode',$encode);
	$page->output();
require("footer.php");
die();
?>